import unittest
from utils import *


CPP_TOOLS_DIR = './cpp_tools'
class testSuite(unittest.TestCase):
    def __base__(self, cpp_filename : str):
        exe_filename = compile_CPP_TestingCodes(CPP_TOOLS_DIR + '/' + cpp_filename)

        # When
        ret = subprocess.call([exe_filename])
        # Then
        self.assertEqual(ret, 0)

        removeCompiledExeFile(exe_filename)


    def test_connect_board(self):
        self.__base__('test_connect_board.cpp')


    def test_reflector(self):
        self.__base__('test_reflector.cpp')


    def test_rotor(self):
        self.__base__('test_rotor.cpp')


    def test_rotor_array(self):
        self.__base__('test_rotor_array.cpp')


    def test_Enigma(self):
        self.__base__('test_Enigma.cpp')


    def test_GenerateKey(self):
        self.__base__('test_GenerateKey.cpp')


if __name__ == '__main__':
    unittest.main(verbosity=2)
    # pass